<?php
/**
 * @author 	 	 faithsmine@gmail.com
 * @copyright		 www
 * @version		 1.0
 * @name 		 list.html.php
 * @todo 		 列表处理前台显示
 * @final 		 2009-12-14
 */
!defined("IN_YCTOOL") && exit();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style tape="text/css">
<!--
/*公用部分*/
Body{
BORDER-TOP-WIDTH: 20px; PADDING-RIGHT: 20px; PADDING-LEFT: 30px;  BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; text-align:left; font-size:12px;
}
HTML {
BORDER-TOP-WIDTH: 0px; PADDING-RIGHT: 0px; PADDING-LEFT: 0px;BORDER-BOTTOM-WIDTH: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px;
}
table{margin-bottom:10px;}
td{BORDER-BOTTOM: #dedede 1px dashed;}
SELECT {FONT-SIZE: 12px; VERTICAL-ALIGN: middle; WIDTH:100px;}
INPUT {FONT-SIZE: 12px; VERTICAL-ALIGN: middle;}
TEXTAREA {FONT-SIZE: 12px; VERTICAL-ALIGN: middle;}
div,form,img,ul,ol,li,dl,dt,dd {margin: 0px; padding: 0px; border: 0px;}
h1,h2,h3,h4,h5,h6 { margin:0px; padding:0px;}
table,td,tr,th{font-size:12px;}
a:link {color: #5a5a5a;text-decoration: none;}
a:visited {color: #5a5a5a;text-decoration: none;}
a:hover {color: #5c0e8f;text-decoration:underline;} 
a:active {color: #5a5a5a;text-decoration: none;}
.area_box{ margin:0px auto; padding:0px; width:850px; text-align:left; font-size:12px; line-height:30px;}
.area_box h4{ font-size:14px;}
.row {BACKGROUND-COLOR: expression(rowIndex%2==1?'':'#F2F3FD'); text-align:center;}
img{ border:1px #C4C4C4 solid;}
-->
</style>
<script type="text/javascript" src="../javascript/common.js"></script>
<script type="text/javascript">

//复选
function selectAll(chk)
{    
var chk = document.form2.chkAll.checked;
for (i=0;i<document.all.length;i++) {
if (document.all[i].name=="order[]") {
document.all[i].checked=chk;
chkRow(document.all[i]);
}}}
//复选后单元格变色
function chkRow(obj){
var r = obj.parentElement.parentElement;
if(obj.checked){ r.style.backgroundColor="#FFFFCC";}
else {if(r.rowIndex%2==1)r.style.backgroundColor="#F0FDFF";else r.style.backgroundColor="#F5F5F5";}
}
function ajaxUpRoles(uproles)
{
    if (uproles != '')
    {
        alert('修改成功');
    }
}
function upRoles(uid)
{    
    ajaxpost(ajaxUpRoles, "ajax=uproles&uid=" + uid + "&uroles=" + $("#id_uroles" + uid).val());
}

function ajaxUpCset(upcset)
{
    if(upcset)
    {
        alert("设置成功");
    }
}
function upCset(clsid)
{
    ajaxpost(ajaxUpCset, "ajax=upcset&clsid=" + clsid + "&cset=" + $("#id_cset" + clsid).val());
}

function delIn()
{
    if (confirm("您确定要删除吗？与这些项目相关的资料也将删除不可恢复！请谨慎处理！")) 
    {
            document.form2.actionU.value='delIn';
            document.form2.submit();
    }
    else
    {
            return false;
    }
}
</script> 

<SCRIPT type=text/javascript>
function checkall(form, prefix, checkall) {
 var checkall = checkall ? checkall : 'chkall';
 for(var i = 0; i < form.elements.length; i++) {
  var e = form.elements[i];
  if(e.name && e.name != checkall && (!prefix || (prefix && e.name.match(prefix)))) {
   e.checked = form.elements[checkall].checked;
  }
 }
}
</SCRIPT>
<script language="javascript" src="../javascript/del_confirm.js"></script>
<script language="javascript" src="../javascript/selected_form.js"></script>
<script language="javascript" src="../javascript/jquery.js"></script>
<title>控制后台</title>
</head>
<body>
<?php
foreach ($typearray as $key => $value)
{
    if($type == $key) {$typename = $value;}
}

?>
<form action="" method="post" name="form2" id="form2"> 

<br /><br />
<?php 
    if ($operation == 'news')
    { ?>
 
        标题关键字： <input name="ntitle" size='20' value="<?php echo $ntitle; ?>" />
        发布时间：<input name="nposttime" size='20' value = "<?php echo $nposttime; ?>" />
发布人：<input name="nuname" size='20' value="<?php echo $nuname; ?>" />
<input name="submit2" type="submit" value="搜索<?php echo $typename;?>" />
<hr style="width:100%;height:1px;color:#EFF669;">
<br/><br/>
<table width="99%" border="0" cellpadding="0" cellspacing="0" >
<tr  style="font-size:20;text-align:center;"><td>&nbsp;</td><td><?php echo $typename;?>ID</td><td><?php echo $typename;?>标题</td>
    <td><?php echo $typename;?>内容</td><td><?php echo $typename;?>发布人</td><td><?php echo $typename;?>发布时间</td>
    <td>操作</td></tr>
<?php
if ($rslist)
{
foreach($rslist as $key => $item)
{?>
  <tr class="row">
    <td height="50" >
<input type="checkbox" name="order[]" value="<?php echo $item['nid']; ?>" onClick="javascript:chkRow(this);">
    </td>
    <td><?php echo $item['nid']; ?></td>
    <td><a href="#" title="<?php echo $item['ntitle']; ?>" onclick="location.href='<?php echo $viewurl.'&id='.$item['nid']; ?>'">
<?php echo func::cutStr($item['ntitle'], 18, 1); ?></a></td>
    <td><a href="#" title="<?php echo $item['ncontent'];?>" onclick="location.href='<?php echo $viewurl.'&id='.$item['nid']; ?>'">
        <?php echo func::cutStr($item['ncontent'], 24, 1); ?></a></td>
    <td><?php echo $item['nuname']; ?></td>
    <td><?php echo $item['nposttime']; ?></td>
  <td><a href="#" onclick="location.href='<?php echo $viewurl.'&id='.$item['nid']; ?>'">查看</a>
  <a href="#" onclick="location.href='<?php echo $posturl.'&id='.$item['nid'];?>'">修改</a></td>
 
  </tr> 
<?php }
}
else
{
    echo '<tr><td colspan=8 align=center ><font color=red>没有搜索到符合条件的数据</font></td></tr>'; 
}?>
</table>	 
<?php }  ?>
 
<?php if ($operation == 'products')
{ ?>

<?php echo $typename;?>名称：<input name="pname" size='20' value="<?php echo $pname;?>" />
<?php echo $typename;?>类别：<SELECT name="pclass" id="id_pclass">
<?php
    foreach ($pcls_arrs as $key => $val)
    {
        echo "<option value='".$val['clsid'] . "'>" . $val['clsname'] . "</option>";
    }                                 
?></SELECT>
<script language="javascript">
    selectisvalue('#id_pclass','<?php echo $pclass; ?>');
</script>
<?php echo $typename;?>单价：<input name="pprice1" size='10' value="<?php echo $pprice1; ?>" /> - <input name="pprice2" size='10'value="<?php echo $pprice2; ?>" />元
<input name="submit2" type="submit" value="搜索<?php echo $typename;?>" />

<hr style="width:100%;height:1px;color:#EFF669;"/>
<br/><br/>
<table width="99%" border="0" cellpadding="0" cellspacing="0" >
<tr style="font-size:20;text-align:center;"><td>&nbsp;</td><td><?php echo $typename;?>ID</td><td><?php echo $typename;?>名称</td><td><?php echo $typename;?>类别</td>
<td><?php echo $typename;?>规格</td><td><?php echo $typename;?>市场价</td><td><?php echo $typename;?>优惠价</td><td>操作</td></tr>
<?php
    if ($rslist)
    {
foreach($rslist as $key => $item)
{?>
  <tr class="row">
    <td height="50" >
<input type="checkbox" name="order[]" value="<?php echo $item['pid']; ?>" onClick="javascript:chkRow(this);">
    </td>
    <td><?php echo $item['pid']; ?></td>
    <td><a href="#" title="查看" onclick="location.href='<?php echo $viewurl.'&id='.$item['pid']; ?>'">
        <?php echo $item['pname']; ?></a></td>
    <td><?php echo $pcls_arrs2[$item['pclass']]; ?></td>
    <td><?php echo $item['pstandard']; ?></td>
    <td><?php echo $item['pprice']; ?>元</td>
    <td><?php echo $item['poffers']; ?>元</td>
    <td><a href="#" onclick="location.href='<?php echo $viewurl.'&id='.$item['pid']; ?>'">查看</a> 
    <a href="#" onclick="location.href='<?php echo $posturl.'&id='.$item['pid'];?>'">修改</a> 
     </td>
  </tr> 
<?php }
    } else
{
    echo '<tr><td colspan=8 align=center ><font color=red>没有搜索到符合条件的数据</font></td></tr>';
}
?>
</table>	 
 <?php }  ?>

 
<?php if ($operation == 'user')
{ ?>

用户姓名：<input name="uname" size='20' value="<?php echo $uname;?>" />
联系电话：<input name="tel" size='20' value="<?php echo $tel; ?>" />  
<input name="submit2" type="submit" value="搜索用户" />

<hr style="width:100%;height:1px;color:#EFF669;"/>
<br/><br/>
<table width="99%" border="0" cellpadding="0" cellspacing="0" >
<tr style="font-size:20;text-align:center;"><td>&nbsp;</td><td>用户ID</td>
<td>用户姓名</td><td>用户角色</td><td>用户邮箱</td><td>性别</td><td>注册时间</td><td>操作</td></tr>
<?php
    if ($rslist)
    {
foreach($rslist as $key => $item)
{?>
  <tr class="row">
    <td height="50" >
<input type="checkbox" name="order[]" value="<?php echo $item['userid']; ?>" onClick="javascript:chkRow(this);">
    </td>
    <td><?php echo $item['userid']; ?></td>
    <td><a href="#" title="查看用户" onclick="location.href='<?php echo $viewurl.'&id='.$item['userid']; ?>'">
        <?php echo $item['username']; ?></a></td>
    <td><SELECT id="id_uroles<?php echo $item['userid']; ?>" name="roles">
        <?php
        foreach($roles_arr as $key => $val)
        {
        ?>
        <option value="<?php echo $key; ?>"><?php echo $val; ?></option>
        <?php } ?>
        </SELECT>
        <script language="javascript">
           selectisvalue('#id_uroles<?php echo $item['userid']; ?>',"<?php echo $item['roles']; ?>");
        </script>
    </td>
    <td><a href="mailto:<?php echo $item['email']; ?>" ><?php echo $item['email']; ?></a></td>
    <td><?php if ($item['sex'] == 1) {echo '男';} else {echo '女';} ?></td>
    <td><?php echo $item['regtime']; ?></td>
    <td>
        <a href="#" onclick="location.href='<?php echo $viewurl.'&id='.$item['userid']; ?>'">查看</a> 
        <a href="javascript:;" onclick="upRoles('<?php echo $item['userid']; ?>')">提交</a> 
    </td>
  </tr> 
<?php }
    } else
{
    echo '<tr><td colspan=8 align=center ><font color=red>没有搜索到符合条件的数据</font></td></tr>';
}
?>
</table>	 
<?php } 

if ($operation == 'pcls')
{ ?>
       <?php echo $typename;?>名称： <input name="clsname" size='20' value="<?php echo $clsname; ?>" />
        <input name="submit2" type="submit" value="搜索<?php echo $typename;?>" />
<hr style="width:100%;height:1px;color:#EFF669;">
<br/><br/>
<table width="99%" border="0" cellpadding="0" cellspacing="0" >
<tr  style="font-size:20;text-align:center;"><td>&nbsp;</td><td><?php echo $typename;?>ID</td><td><?php echo $typename;?>名称</td>
    <td>所属<?php echo $typename;?></td><td><?php echo $typename;?>状态</td><td>操作</td></tr>
<?php
if ($rslist)
{
foreach($rslist as $key => $item)
{?>
  <tr class="row">
    <td height="50" >
<input type="checkbox" name="order[]" value="<?php echo $item['clsid']; ?>" onClick="javascript:chkRow(this);">
    </td>
    <td><?php echo $item['clsid']; ?></td>
    <td ><?php echo $item['clsname']; ?></td>
    <td><?php echo $item['paid']; ?></td>
 
    <td><select name="cset" id="id_cset<?php echo $item['clsid']; ?>"><option value="1">正常出售</option><option value="2">隐藏标签</option></select>
<script language="javascript">
    selectisvalue('#id_cset<?php echo $item['clsid']; ?>','<?php echo $item['cset']; ?>');
</script>  </td>
  <td> 
       <a href="#" onclick="upCset('<?php echo $item['clsid']; ?>')">提交</a>
  </td> 
  </tr> 
<?php }
}
else
{
    echo '<tr><td colspan=8 align=center ><font color=red>没有搜索到符合条件的数据</font></td></tr>'; 
}?>
</table>	 
<?php }  
if ($operation == 'plabel')
{ ?>
 
       <?php echo $typename;?>名称： <input name="clsname" size='20' value="<?php echo $clsname; ?>" />
        <input name="submit2" type="submit" value="搜索<?php echo $typename;?>" />
<hr style="width:100%;height:1px;color:#EFF669;">
<br/><br/>
<table width="99%" border="0" cellpadding="0" cellspacing="0" >
<tr  style="font-size:20;text-align:center;"><td>&nbsp;</td><td><?php echo $typename;?>ID</td><td><?php echo $typename;?>名称</td>
    <td>所属分类</td><td><?php echo $typename;?>状态</td><td>操作</td></tr>
<?php
if ($rslist)
{
foreach($rslist as $key => $item)
{?>
  <tr class="row">
    <td height="50" >
<input type="checkbox" name="order[]" value="<?php echo $item['clsid']; ?>" onClick="javascript:chkRow(this);">
    </td>
    <td><?php echo $item['clsid']; ?></td>
    <td ><?php echo $item['clsname']; ?></td>
    <td><?php echo $plabel_arrs2[$item['paid']]; ?></td>
 
    <td><select name="cset" id="id_cset<?php echo $item['clsid']; ?>"><option value="1">正常出售</option><option value="2">隐藏标签</option></select>
<script language="javascript">
    selectisvalue('#id_cset<?php echo $item['clsid']; ?>','<?php echo $item['cset']; ?>');
</script>  </td>
  <td> 
       <a href="#" onclick="upCset('<?php echo $item['clsid']; ?>')">设置状态</a>
  </td> 
  </tr> 
<?php }
}
else
{
    echo '<tr><td colspan=8 align=center ><font color=red>没有搜索到符合条件的数据</font></td></tr>'; 
}?>
</table>	 
<?php }  ?>

<br />
<!-- operation 完毕 -->

<?php if ($operation)
{ ?>
<!-- 搜索信息单条循环end -->

<div class="quotes">
    <div>全选 <INPUT onclick="checkall(this.form, 'order')" type=checkbox  name=chkall>
    &nbsp;<span class="b">  --- <input type="hidden" name="actionU" value="" >
    <input type="button" onClick="javascript:delIn()" value=" 删 除 ">
    </span> --- &nbsp;  &nbsp; 
            <?php echo $page; ?>
    </div>
</div>
  <?php }  ?>
</div>
</div>
</div>
</form>
</body>
</html>
